package com.kehutong.charge.admin;

import com.kehutong.charge.service.ChargePenaltyService;
import com.kehutong.common.util.Token;
import org.coraframework.authz.HasPermission;
import org.coraframework.inject.Inject;
import org.coraframework.json.JSONObject;
import org.coraframework.logger.Logger;
import org.coraframework.logger.LoggerFactory;
import org.coraframework.mvc.MvcAction;
import org.coraframework.mvc.http.ReqMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @program: kht
 * @description: 违约金管理
 * @author: jian Ye
 * @create: 2021/7/29
 **/
@MvcAction
@ReqMapping("/admin/pay/charge/penalty")
public class ChargePenaltyController {

    private static final Logger logger = LoggerFactory.getLogger(ChargePenaltyController.class);

    @Inject
    ChargePenaltyService chargePenaltyService;

    @ReqMapping("/pageOrder")
    @HasPermission("pay:charge:penalty:view")
    public Object pageOrder(JSONObject jsonObject) throws Exception {
        return chargePenaltyService.findPage(jsonObject);
    }


    @ReqMapping("/pageOrder/export")
    @HasPermission("pay:charge:penalty:view")
    public void pageOrderExport(HttpServletRequest req, HttpServletResponse resp, JSONObject jsonObject){
        chargePenaltyService.pageOrderExport(req,resp,jsonObject);
    }


    /**
     * 违约小区统计分页
     */
    @ReqMapping("/statist/page")
    @HasPermission("pay:charge:penalty:view")
    public Object statistPage(JSONObject jsonObject,Token token) throws Exception {
        return chargePenaltyService.findStatistPage(jsonObject);
    }


    @ReqMapping("/statist/page/export")
    @HasPermission("pay:charge:penalty:view")
    public void statistPageExport(HttpServletRequest req, HttpServletResponse resp,JSONObject jsonObject){
        chargePenaltyService.statistPageExport(req,resp,jsonObject);
    }


    /**
     * 违约住户分页
     * @param jsonObject
     * @return
     */
    @ReqMapping("/house/page")
    @HasPermission("pay:charge:penalty:view")
    public Object housePage(JSONObject jsonObject) {
        return chargePenaltyService.housePage(jsonObject);
    }


    @ReqMapping("/house/page/export")
    @HasPermission("pay:charge:penalty:view")
    public void housePageExport(HttpServletRequest req, HttpServletResponse resp,JSONObject jsonObject) {
        chargePenaltyService.housePageExport(req,resp,jsonObject);
    }

    /**
     * 违约金统计
     * @param jsonObject
     */
    @ReqMapping("/statist")
    public Object findStatist(JSONObject jsonObject) {

        return chargePenaltyService.findStatist(jsonObject);
    }


    /**
     * 违约住户详情分页
     * @param jsonObject
     * @return
     */
    @ReqMapping("/house/detail/page")
    @HasPermission("pay:charge:penalty:view")
    public Object houseDetailPage(JSONObject jsonObject) {
        return chargePenaltyService.houseDetailPage(jsonObject);
    }
}
